cmake_minimum_required(VERSION 3.5)
include(GNUInstallDirs)

project(lib_package)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -std=c++17 -g")

add_library(dal__dalidl_typesupport_fastrtps_cpp_compatible SHARED
    ${CMAKE_SOURCE_DIR}/dal_msg/src/dcutils/src/strdup.c
    ${CMAKE_SOURCE_DIR}/dal_msg/src/dalidl/dalidl_runtime_c/src/message_type_support.c
    ${CMAKE_SOURCE_DIR}/dal_msg/src/dalidl_typesupport/dalidl_typesupport_cpp/src/identifier.cpp
    ${CMAKE_SOURCE_DIR}/dal_msg/src/dalidl_typesupport/dalidl_typesupport_cpp/src/message_type_support_dispatch.cpp
    ${CMAKE_SOURCE_DIR}/dal_msg/src/dalidl_typesupport_fastrtps/dalidl_typesupport_fastrtps_cpp/src/identifier.cpp
    ./dalidl_typesupport_fastrtps_cpp/dal/msg/detail/dds_fastrtps/underlay_message__type_support.cpp
)

target_link_libraries(dal__dalidl_typesupport_fastrtps_cpp_compatible fastrtps fastcdr)

target_include_directories(dal__dalidl_typesupport_fastrtps_cpp_compatible PUBLIC
    ${CMAKE_SOURCE_DIR}/dal_msg/include/dcutils
    ${CMAKE_SOURCE_DIR}/dal_msg/include/dcpputils
    ${CMAKE_SOURCE_DIR}/dal_msg/include/dalidl
    ${CMAKE_SOURCE_DIR}/dal_msg/include/dalidl/dalidl_runtime_c
    ${CMAKE_SOURCE_DIR}/dal_msg/include/dalidl/dalidl_runtime_cpp
    ${CMAKE_SOURCE_DIR}/dal_msg/include/dalidl_typesupport
    ${CMAKE_SOURCE_DIR}/dal_msg/include/dalidl_typesupport_fastrtps
    ${CMAKE_SOURCE_DIR}/dal_msg/include/dalidl_typesupport_interface
    ./dalidl_generator_cpp
    ./dalidl_typesupport_fastrtps_cpp
)

add_library(dal__dalidl_typesupport_introspection_cpp_compatible SHARED
    ${CMAKE_SOURCE_DIR}/dal_msg/src/dalidl/dalidl_runtime_c/src/message_type_support.c
    ${CMAKE_SOURCE_DIR}/dal_msg/src/dalidl_typesupport/dalidl_typesupport_cpp/src/identifier.cpp
    ${CMAKE_SOURCE_DIR}/dal_msg/src/dalidl/dalidl_typesupport_introspection_cpp/src/identifier.cpp
    ${CMAKE_SOURCE_DIR}/dal_msg/src/dalidl_typesupport/dalidl_typesupport_cpp/src/message_type_support_dispatch.cpp
    ./dalidl_typesupport_introspection_cpp/dal/msg/detail/underlay_message__type_support.cpp
)

target_include_directories(dal__dalidl_typesupport_introspection_cpp_compatible PUBLIC
    ${CMAKE_SOURCE_DIR}/dal_msg/include/dcutils
    ${CMAKE_SOURCE_DIR}/dal_msg/include/dcpputils
    ${CMAKE_SOURCE_DIR}/dal_msg/include/dalidl
    ${CMAKE_SOURCE_DIR}/dal_msg/include/dalidl/dalidl_runtime_c
    ${CMAKE_SOURCE_DIR}/dal_msg/include/dalidl/dalidl_runtime_cpp
    ${CMAKE_SOURCE_DIR}/dal_msg/include/dalidl_typesupport
    ${CMAKE_SOURCE_DIR}/dal_msg/include/dalidl_typesupport_interface
    ${CMAKE_SOURCE_DIR}/dal_msg/include/dalidl_typesupport_introspection
    ./dalidl_generator_cpp
    ./dalidl_typesupport_introspection_cpp
)

install(TARGETS 
            dal__dalidl_typesupport_fastrtps_cpp_compatible
            dal__dalidl_typesupport_introspection_cpp_compatible
        LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})